<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<jsp:include page="includes/header.jsp" />

<script>
function validateForm(frm) {
	if (frm.newPassword.value != frm.retypedNewPassword.value) {
		alert("Retyped new password is not the same as new password.");
		return;
	}
	
	frm.submit();
}
</script>
<c:out value="${changePasswordError}" />
<form:form action="submitChangePassword.action" commandName="changePasswordForm">
	<c:if test="${changePasswordError}">
	<div class="ui-widget">
			<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
				<strong>Your old password was incorrect!!!</strong></p>
			</div>
		</div>
		<br>
		<br>
	</c:if>
	<table width="75%">
		<tr>
			<td>Old Password:</td>
			<td><form:password path="oldPassword" /></td>
		</tr>
		<tr>
			<td>New Password:</td>
			<td><form:password path="newPassword" /></td>
		</tr>
		<tr>
			<td>Retype New Password:</td>
			<td><input type="password" name="retypedNewPassword" /></td>
		</tr>		
		<tr>
		<td colspan="2"><input type="button" value="Submit" onclick="validateForm(this.form)"></input></td>
		</tr>		
	</table>
</form:form>
</html>